package com.gqz.equip.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gqz.common.core.domain.R;
import com.gqz.common.core.domain.RequestForm;
import com.gqz.equip.api.TEnStockTaskApi;
import com.gqz.equip.app.service.MqEnStockTaskService;
import com.gqz.equip.service.ITEnStockTaskService;
import com.gqz.equip.vo.*;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 能源-盘点任务 Controller
 *
 * @Version 1.0
 * @Author input you name
 */
@RestController
public class TEnStockTaskController implements TEnStockTaskApi {

    @Autowired
    private ITEnStockTaskService service;

    @Autowired
    private MqEnStockTaskService mqService;
//    @Resource
//    private GisFegin gisFegin;

    @Override
    public R<List<EnStockTaskVo>> getById(String id) {
        return R.ok(service.getById(id));
    }

    @Override
    public R<List<EnStockTaskVo>> getByTaskNo(String taskNo) {
        return R.ok(service.getByTaskNo(taskNo));
    }

    @Override
    public R<Page<EnStockTaskVo>> page(@Valid RequestForm<EnStockTaskVo> requestForm) {
        return R.ok(service.page(requestForm));
    }

    @Override
    public R<Long> count(@Valid RequestForm<EnStockTaskVo> requestForm) {
        return R.ok(service.count(requestForm));
    }

    @Override
    public R<Integer> insert(List<EnStockTaskVo> vos) {
        return R.ok(this.mqService.insert(vos));
    }

    @Override
    public R<Integer> update(List<EnStockTaskVo> vos) {
        return R.ok(this.mqService.update(vos));
    }

    @Override
    public R<List<EnStockTaskEquipVo>> getTaskEquipList(String taskNo) {
        return R.ok(service.getTaskEquipList(taskNo));
    }

    @Override
    public R<Page<TEnStockEquipVo>> getEquipPage(RequestForm<TEnWzEquipVo> requestForm) {
        return R.ok(service.getEquipPage(requestForm));
    }

    @Override
    public R<TEnStockTaskProcessVo> getTaskProcess(String taskNo) {
        return R.ok(service.getTaskProcess(taskNo));
    }

    @Override
    public R<Page<EnStockTaskVo>> getOrderPage(RequestForm<EnStockTaskVo> requestForm) {
        return R.ok(service.getOrderPage(requestForm));
    }

    @Override
    public R getTaskDetailPage(RequestForm<EnStockTaskDetailVo> requestForm) {
        return R.ok(service.getTaskDetailPage(requestForm));
    }


    @Override
    public R<Integer> sendOrder(EnStockTaskVo vo) {
        return R.ok(this.mqService.sendOrder(vo));
    }

    @Override
    public R<List<EnStockEquipDefectVo>> getTaskDefectList(String taskNo) {
        return R.ok(service.getTaskDefectList(taskNo));
    }

    @Override
    public R<Object> getTaskNo() {
        return R.ok(this.service.getTaskNo());
    }

    @Override
    public R<List<StockEquipStatisticsVo>> getEquipStatisticsByTaskNo(String taskNo) {
        return R.ok(service.getEquipStatisticsByTaskNo(taskNo));
    }

    @Override
    public R<Page<EnStockTaskEquipVo>> getTaskEquipListPage(RequestForm<StockEquipStatisticsVo> requestForm) {
        return R.ok(service.getTaskEquipListPage(requestForm));
    }

    @Override
    public void exportExcel(HttpServletResponse response, @Valid RequestForm<EnStockTaskDetailVo> requestForm) {
        service.exportExcel(response, requestForm);
    }

    @Override
    public List<EnStockGisVo> energyPtgis(String startTime, String endTime, String yhid) {
//        return gisFegin.list(startTime,endTime,yhid);
        return null;
    }

}
